﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Milan;
using Milan.Deploy;
using System.Diagnostics;

namespace Milantest
{
	class Program
	{
		static void Main(string[] args)
		{
			// Programmatically define this package -- This can also be done in an XML
			Package package = Application.ThisPackage = new Package();
			package.Files.Add(new Package.File("milantest.exe", "milantest.exe"));
			package.Files.Add(new Package.File("milan.dll", "milan.dll"));
			package.Links.Add(new Package.Link("Run MilanTest", "Milan Test", "", "milantest.exe", "",""));
//			package.Save("milantest.pkg");
			// Set the GUI for requesting data not found in Settings.
			Settings.GUI = new ConsoleHumanInterface();
			string statusServer = args.Length>0 ? args[0] : null;
			using(LocalUserOnly localUserApplication = new LocalUserOnly(args,statusServer))
			{
				// This application could possibly be run as a server, so first we check if that is a possibility
				//localUserApplication.RunService(new ServerTest(localUserApplication), Application.Type.ConsoleBlocking, Application.TriggerType.FirstWord, "server");
				// If we don't run as a server, then run the client version of the program.
				localUserApplication.RunService(new ClientTest(localUserApplication), Application.Type.ConsoleBlocking, Application.TriggerType.Fallback);
				Console.WriteLine("Process with id: "+ Process.GetCurrentProcess().Id + " is exiting...");
			}
			Console.ReadKey();
		}
	}
}
